package com.monitorRoutine.monitorRoutineServer.util;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONException;

import java.util.Map;

public class JSONUtil {
    public static Map<String, Object> isValidJson(String jsonString) {
        try {
            return JSON.parseObject(jsonString, Map.class);

        } catch (JSONException e) {
            return null;
        }
    }
    public static <T> T isValidJson(String jsonString,Class<T> objectClass) {
            try {
            return JSON.parseObject(jsonString, objectClass);

        } catch (JSONException e) {
            return null;
        }
    }
}
